﻿using System;
class inArray
{
   
    public static int FindMax(ref int[] array,out int max)
    {
        max = 0;
        foreach (int i in array)
        {
            if (i > max)
            {
                max = i;
            }
        }
        return max;
    }
    public static int FindMin(ref int[] array,out int min)
    {
        min = array[0];
        foreach (int i in array)
        {
            if (i < min)
            {
                min = i;
            }
        }
        return min;
    }
   
    public static void GetSum(ref int[] array,out int sum,out double average)
    {
        sum = 0;
        foreach (int i in array)
        {
            sum += i;
        }
        average=(double)sum/ array.Length;
    }
    static void Main(String[] args)
    {
        Console.WriteLine("请输入一组用空格分隔的数字");
        string s = Console.ReadLine();
        int[] Array1 = Array.ConvertAll(s.Split(' '), int.Parse);
        int max, min;
        inArray.FindMax(ref Array1, out max);
        inArray.FindMin(ref Array1, out min);
        Console.WriteLine("最大值是：" + max);
        Console.WriteLine("最小值是：" + min);
        int sum;
        double average;
        inArray.GetSum(ref Array1, out sum, out average);
        Console.WriteLine("平均值是：" + average);
        Console.WriteLine("总和是：" + sum);
    }

}

